<?php

namespace Api\Model;

use Think\Model;

class ClassModel extends Model {

    function addClass($class_name, $description, $user_id, $username, $code) {
        $data = array(
            'classname' => $class_name,
            'description' => $description,
            'user_id' => $user_id,
            'username' => $username,
            'status' => 1,
            'code' => $code,
            'createtime' => date('Y-m-d H:i:s')
        );
        return $this->add($data);
    }

    function upClassbyId($class_id, $updata) {
        return $this->where('id = ' . $class_id)->save($updata);
    }

    function getClassbycid($class_id) {
        $where = array('id' => $class_id);
        return $this->where($where)->find();
    }

}
